import dayjs from 'dayjs'

const state = () => ({
  // 图层基础服务存放
  baseLayer: {
    currentMap: '3',
    checkedMapData: {},
    ylStart: dayjs().format('YYYY-MM-DD 00:00:00'),
    ylEnd: dayjs().format('YYYY-MM-DD 23:59:59')
  },
  // 边界图层存放
  boundaryLayer: {
    lyCurrent: [],
    xzCurrent: []
  },
  // 测站图层存放
  stationLayer: {
    1: [],
    2: [],
    3: [],
    4: [],
    5: [],
    6: []
  },
  // 测站图层文字配置
  stationTextOption: {
    'station-1': { color: '#333', fontSize: '12', showText: '1' },
    'station-2': { color: '#333', fontSize: '12', showText: '1' },
    'station-3': { color: '#333', fontSize: '12', showText: '1' },
    'station-4': { color: '#333', fontSize: '12', showText: '1' },
    'station-5': { color: '#333', fontSize: '12', showText: '1' },
    'station-6': { color: '#333', fontSize: '12', showText: '1' }
  },
  // 水利工程存放
  projectLayer: {
    0: [],
    1: [],
    2: [],
    3: [],
    4: [],
    5: [],
    6: [],
    7: [],
    8: [],
    9: []
  },
  // 水利工程文字配置
  projectTextOption: {
    'gc-0': { color: '#333', fontSize: '12', showText: '1' },
    'gc-1': { color: '#333', fontSize: '12', showText: '1' },
    'gc-2': { color: '#333', fontSize: '12', showText: '1' },
    'gc-3': { color: '#333', fontSize: '12', showText: '1' },
    'gc-4': { color: '#333', fontSize: '12', showText: '1' },
    'gc-5': { color: '#333', fontSize: '12', showText: '1' },
    'gc-6': { color: '#333', fontSize: '12', showText: '1' },
    'gc-7': { color: '#333', fontSize: '12', showText: '1' },
    'gc-8': { color: '#333', fontSize: '12', showText: '1' },
    'gc-9': { color: '#333', fontSize: '12', showText: '1' }
  },
  // 主表信息存放
  exportFormData: {},
  // 地图导出边界范围
  exportExtent: [],
  // 图例信息存放
  legendData: {
    left: '',
    top: '',
    fontSize: '3',
    positionType: '4'
  },
  // 标题信息存放
  titleData: {
    title: '',
    fontSize: '8',
    color: '#FF0000',
    left: '',
    top: ''
  },
  // 其他信息存放
  otherData: {
    bzdw: '',
    bzFontSize: '11',
    bzColor: '#FF0000',
    bzLeft: '',
    bzTop: ''
  },
  dateData: {
    bzrq: dayjs().format('YYYY-MM-DD'),
    bzFontSize: '11',
    bzColor: '#FF0000',
    bzLeft: '',
    bzTop: ''
  },
  compassPosition: {
    left: '',
    top: '',
    positionType: '1'
  }
})

const mutations = {
  setBaseLayer (state, payload) {
    state.baseLayer = payload
  },
  setBoundaryLayer (state, payload) {
    state.boundaryLayer = payload
  },
  setStationLayer (state, payload) {
    state.stationLayer = payload
  },
  setStationTextOption (state, payload) {
    state.stationTextOption = payload
  },
  setProjectLayer (state, payload) {
    state.projectLayer = payload
  },
  setProjectTextOption (state, payload) {
    state.projectTextOption = payload
  },
  setExportFormData (state, payload) {
    state.exportFormData = payload
  },
  setExportExtent (state, payload) {
    state.exportExtent = payload
  },
  setLegendData (state, payload) {
    state.legendData = payload
  },
  setCompassPosition (state, payload) {
    state.compassPosition = payload
  },
  setTitleData (state, payload) {
    state.titleData = payload
  },
  setOtherData (state, payload) {
    state.otherData = payload
  },
  setDateData (state, payload) {
    state.dateData = payload
  }
}

export default { state, mutations }
